package com.monlyu.action.programming;

import java.util.Date;
import java.util.List;

import com.monlyu.action.PageAction;
import com.monlyu.bo.ProgrammingBo;
import com.monlyu.bo.StaffScoreBo;
import com.monlyu.vo.ProStaffInfo;
import com.monlyu.vo.Programming;
import com.monlyu.vo.StaffScore;

/*******************************************************************************
 * 
 * <b>功能描述☞</b>串联单的后期人员打分<br>
 * 
 * <b>开发公司☞</b>重庆唯尼科技有限公司<br>
 * <b>版权☞</b>本文件归重庆唯尼科技有限公司所有<br>
 * <b>项目名☞</b>news<br>
 * <b>文件路径☞</b>com.monlyu.action.programming.GradeStaffAction.java<br>
 * <b>开发日期☞</b>2010-3-25 <br>
 * 
 * @author chendan
 * @since JDK 5
 * @version 1.0.8
 * 
 ******************************************************************************/
public class GradeStaffAction extends PageAction {

	/** 串联单 */
	private Programming programming;

	private ProgrammingBo programmingBo;
	private String contentInfo;
	private ProStaffInfo proStaffInfo;
	private StaffScoreBo staffScoreBo;
	private List<StaffScore> staffScores;
	private Date beginDate;
	private Date endDate;
	private String userIds;
	private Float sum;

	/** 类型：打分或统计的类型 */
	private String type;

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	/**
	 * 跳转到查询页面
	 * 
	 * @return
	 * @since chendan 2010-3-25
	 */
	public String toSearch() {
		if (programming != null) {
			// if (programming.getDate() != null
			// && programming.getColumn() != null) {
			// programming = programmingBo.getProgramming(programming);
			// } else if (programming.getId() != null) {
			// programming = programmingBo.getProgramming(programming.getId());
			// }
			// programmingBo.check(programming);

			staffScores = staffScoreBo.getGradeUser(programming, type,
					beginDate, endDate);
		}
		return view("gradeStaff.jsp");
	}

	/**
	 * 打分
	 * 
	 * @return
	 * @since chendan 2010-3-25
	 */
	public String grade() {
		staffScoreBo.grade(contentInfo);
		return ajax();
	}

	public String tosearchGrade() {
		return view("countGradeStaff.jsp");
	}

	/**
	 * 查询统计分数
	 * 
	 * @return
	 * @since chendan 2010-3-25
	 */
	public String searchGrade() {
		Object[] objects = staffScoreBo.countScore(userIds, beginDate, endDate,
				programming, type);
		staffScores = (List) objects[0];
		sum = (Float) objects[1];
		return view("countGradeStaff.jsp");
	}

	public Programming getProgramming() {
		return programming;
	}

	public void setProgramming(Programming programming) {
		this.programming = programming;
	}

	public ProStaffInfo getProStaffInfo() {
		return proStaffInfo;
	}

	public void setProStaffInfo(ProStaffInfo proStaffInfo) {
		this.proStaffInfo = proStaffInfo;
	}

	public void setProgrammingBo(ProgrammingBo programmingBo) {
		this.programmingBo = programmingBo;
	}

	public List<StaffScore> getStaffScores() {
		return staffScores;
	}

	public void setStaffScores(List<StaffScore> staffScores) {
		this.staffScores = staffScores;
	}

	public void setStaffScoreBo(StaffScoreBo staffScoreBo) {
		this.staffScoreBo = staffScoreBo;
	}

	public String getContentInfo() {
		return contentInfo;
	}

	public void setContentInfo(String contentInfo) {
		this.contentInfo = contentInfo;
	}

	public Date getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getUserIds() {
		return userIds;
	}

	public void setUserIds(String userIds) {
		this.userIds = userIds;
	}

	public Float getSum() {
		return sum;
	}

	public void setSum(Float sum) {
		this.sum = sum;
	}

}
